Skip to content

[FIX] OWDistances: Mahalanobis wrong dimensions notification.#1762

Merged
astaric merged 2 commits intobiolab:masterfrom
acopar:owdistance-mahalanobis-notification
Nov 18, 2016
Merged

[FIX] OWDistances: Mahalanobis wrong dimensions notification.#1762
astaric merged 2 commits intobiolab:masterfrom
acopar:owdistance-mahalanobis-notification

Conversation

@acopar
Copy link
Copy Markdown
Contributor

@acopar acopar commented Nov 18, 2016

Issue

ValueError: 'Too few observations for the number of dimensions.'

Workflow:

  1. Paint data (paint & send) -> Distance.
  2. Select columns and Mahalanobis metric.
Description of changes

Adds shape check and error notification.

Includes
  • Code changes
  • Tests
  • Documentation

owdistances.py: error notification when there is too few observations for Mahalanobis distance. Prevents ValueError exception from distance/init.py class MahalanobisDistance.

owdistances.py: error notification when there is too few observations for Mahalanobis distance. Prevents ValueError exception from distance/__init__.py class MahalanobisDistance.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Nov 18, 2016

CLA assistant check
All committers have signed the CLA.

@astaric
Copy link
Copy Markdown
Member

astaric commented Nov 18, 2016

Could you try to write a simple tests which sends the wrong kind of data to distance widget and check that a warning is displayed instead of crashing?

@codecov-io
Copy link
Copy Markdown

codecov-io commented Nov 18, 2016

Current coverage is 88.91% (diff: 100%)

Merging #1762 into master will not change coverage

@@             master      #1762   diff @@
==========================================
  Files            82         82          
  Lines          8847       8847          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           7866       7866          
  Misses          981        981          
  Partials          0          0          

Sunburst

Powered by Codecov. Last update 92bba3f...d257f5c

unsupervised/tests/test_owdistances.py:
- tests that compute_distances does not return ValueError
- checks if error message is displayed
self.widget.axis = 1
self.send_signal("Data", self.iris)
self.widget.compute_distances(Mahalanobis, self.iris)
self.assertTrue(self.widget.Error.too_few_observations.is_shown()) No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please configure PyCharm to always include new line on the last line of file?

http://stackoverflow.com/questions/36043061/automatically-add-newline-on-save-in-pycharm

@astaric astaric merged commit b896110 into biolab:master Nov 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants